import { request } from '@/utils/request'

interface LoginInput {
  user: {
    email: string
    password: string
  }
}

export interface User {
  email: string
  token: string
  image: string
  bio: string
  username: string
}

interface LoginPayload {
  user: User
}

export const login = (data: LoginInput) => {
  return request.post<LoginPayload>('/api/users/login', data)
}
